package com.iplant.mes.service.po.sfc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.mes.service.mesenum.sfc.SFCFrockBindRecordStatus;
import com.iplant.pdm.service.basicenum.pdm.PDMComponentTypes;

/**
 * 工装绑定元件记录
 *
 * @author YouWang·Peng
 * 2023-8-25 14:28:24
 */
@DBBasePO(TableName = "sfc_frock_bind_record", Name = false, Active = false, Schemas = DBSchemas.MES,
        CheckName = {"Code", "FrockLedgerID,ComponentCode,ComponentType"}, CodeAuto = true, CodePrefix = "FBR-{yyMMdd" +
        "}-",
        CodeNum = 4)
public class SFCFrockBindRecord extends BasePO {

    /**
     * 工装台账ID
     */
    @DBField
    public int FrockLedgerID = 0;

    /**
     * 资产ID
     */
    @DBJoin(name = "AssetInfoID", tableName = "dms_frock_ledger", tableAsName = "dms_frock_ledger1", Schemas =
            DBSchemas.AMS,
            MainTableField = "FrockLedgerID")
    public int AssetInfoID = 0;

    /**
     * 工装名称
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "ams_asset_list", tableAsName = "ams_asset_list1", Schemas = DBSchemas.AMS,
            JoinIndex = 2,
            ConditionalJoin = "dms_frock_ledger1.AssetInfoID=ams_asset_list1.ID")
    public String FrockLedgerName = "";

    /**
     * 工装编码
     */
    @DBCondition
    @DBJoin(name = "Code", tableName = "ams_asset_list", tableAsName = "ams_asset_list1", Schemas = DBSchemas.AMS,
            JoinIndex = 2,
            ConditionalJoin = "dms_frock_ledger1.AssetInfoID=ams_asset_list1.ID")
    public String FrockLedgerCode = "";

    /**
     * 工件码（可能是模具）
     */
    @DBCondition
    @DBField
    public String ComponentCode = "";

    /**
     * 工件类型
     */
    @DBCondition
    @DBField
    public int ComponentType = 0;

    /**
     * 元件类型
     */
    public String ComponentTypeText = "";

    /**
     * 状态
     */
    @DBCondition
    @DBField
    public int Status = 0;

    /**
     * 状态文本
     */
    public String StatusText = "";

    /**
     * 工单ID
     */
    @DBCondition
    @DBField
    public int WorkOrderID = 0;

    /**
     * 工单号
     */
    @DBJoin(name = "Code", tableName = "sfc_task_self", tableAsName = "sfc_taskself1", Schemas = DBSchemas.MES,
            MainTableField = "WorkOrderID")
    public String WorkOrderCode = "";

    /**
     * 数量
     */
    @DBField
    public int Number = 0;

    /**
     * 订单ID
     */
    public int OrderID = 0;
    /**
     * 订单号
     */
    public String OrderNo = "";
    /**
     * 产品ID
     */
    public int ProductID = 0;
    /**
     * 产品型号
     */
    public String ProductNo = "";
    /**
     * 产品名称
     */
    public String ProductName = "";

    @JsonProperty("FrockLedgerID")
    public int getFrockLedgerID() {
        return FrockLedgerID;
    }

    public void setFrockLedgerID(int frockLedgerID) {
        FrockLedgerID = frockLedgerID;
    }

    @JsonProperty("AssetInfoID")
    public int getAssetInfoID() {
        return AssetInfoID;
    }

    public void setAssetInfoID(int assetInfoID) {
        AssetInfoID = assetInfoID;
    }

    @JsonProperty("FrockLedgerName")
    public String getFrockLedgerName() {
        return FrockLedgerName;
    }

    public void setFrockLedgerName(String frockLedgerName) {
        FrockLedgerName = frockLedgerName;
    }

    @JsonProperty("FrockLedgerCode")
    public String getFrockLedgerCode() {
        return FrockLedgerCode;
    }

    public void setFrockLedgerCode(String frockLedgerCode) {
        FrockLedgerCode = frockLedgerCode;
    }

    @JsonProperty("ComponentCode")
    public String getComponentCode() {
        return ComponentCode;
    }

    public void setComponentCode(String componentCode) {
        ComponentCode = componentCode;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("StatusText")
    public String getStatusText() {
        StatusText = SFCFrockBindRecordStatus.getEnumType(Status).getLabel();
        return StatusText;
    }

    public void setStatusText(String statusText) {
        StatusText = statusText;
    }

    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("ComponentTypeText")
    public String getComponentTypeText() {
        ComponentTypeText = PDMComponentTypes.getEnumType(ComponentType).getLabel();
        return ComponentTypeText;
    }

    public void setComponentTypeText(String componentTypeText) {
        ComponentTypeText = componentTypeText;
    }

    @JsonProperty("WorkOrderID")
    public int getWorkOrderID() {
        return WorkOrderID;
    }

    public void setWorkOrderID(int workOrderID) {
        WorkOrderID = workOrderID;
    }

    @JsonProperty("WorkOrderCode")
    public String getWorkOrderCode() {
        return WorkOrderCode;
    }

    public void setWorkOrderCode(String workOrderCode) {
        WorkOrderCode = workOrderCode;
    }

    @JsonProperty("Number")
    public int getNumber() {
        return Number;
    }

    public void setNumber(int number) {
        Number = number;
    }

    @JsonProperty("OrderID")
    public int getOrderID() {
        return OrderID;
    }

    public void setOrderID(int orderID) {
        OrderID = orderID;
    }

    @JsonProperty("OrderNo")
    public String getOrderNo() {
        return OrderNo;
    }

    public void setOrderNo(String orderNo) {
        OrderNo = orderNo;
    }

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductNo")
    public String getProductNo() {
        return ProductNo;
    }

    public void setProductNo(String productNo) {
        ProductNo = productNo;
    }

    @JsonProperty("ProductName")
    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }
}
